cumulative_sum Function

public pure function cumulative_sum(x) result(rst)

Computes the cumulative sum of an array.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x(:)

The N-element array on which to operate.

Return Value real(kind=real64), allocatable, (:)

An N-element array containing the cumulative sum of each element in x (e.g. cumulative_sum(x) = [x(1), x(1) + x(2), ...]).